package org.itzixi.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.itzixi.pojo.FriendCircleLiked;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 * 点赞朋友圈的朋友 Mapper 接口
 * </p>
 *
 * @author 顾文龙
 * @since 2024-06-12
 */
@Repository
public interface FriendCircleLikedMapper extends BaseMapper<FriendCircleLiked> {

    default void deleteByFriendCircleIdAndLikedUserId(String userId, String friendCircleId){
        QueryWrapper<FriendCircleLiked> queryWrapper = new QueryWrapper<>();

        queryWrapper.lambda().eq(FriendCircleLiked::getFriendCircleId, friendCircleId)
                .eq(FriendCircleLiked::getLikedUserId, userId);
        this.delete(queryWrapper);
    }

    default List<FriendCircleLiked> selectByFriendCircleIdAndLikedUserId(String userId, String friendCircleId){
        QueryWrapper<FriendCircleLiked> queryWrapper = new QueryWrapper<>();

        queryWrapper.lambda().eq(FriendCircleLiked::getFriendCircleId, friendCircleId)
                .eq(FriendCircleLiked::getLikedUserId, userId);
        return this.selectList(queryWrapper);
    }

}
